package com.example.drawex;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;



// p.233

public class GraphicText extends View {

	public GraphicText(Context context, AttributeSet attr) {
		super(context, attr);
	}
	
	@Override
	protected void onDraw(Canvas canvas) {

		Paint paint = new Paint();
		paint.setAntiAlias(true);
		paint.setColor(Color.BLUE);
		paint.setTextSize(25);
		
		
		
		Typeface t;
		
		
		t = Typeface.create(Typeface.DEFAULT, Typeface.NORMAL);
		paint.setTypeface(t);
		canvas.drawText("DEFAULT 폰트", 10f, 100f, paint);
		
		t = Typeface.create(Typeface.DEFAULT_BOLD, Typeface.NORMAL);
		paint.setTypeface(t);
	paint.setStrikeThruText(true);
		canvas.drawText("DEFAULT_BOLD 폰트", 10f, 150f, paint);
	paint.setStrikeThruText(false);
		
		t = Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL);
		paint.setTypeface(t);
	paint.setUnderlineText(true);
		canvas.drawText("MONOSPACE 폰트", 10f, 200f, paint);
	paint.setUnderlineText(false);
		
		t = Typeface.create(Typeface.SERIF, Typeface.NORMAL);
		paint.setTypeface(t);
		canvas.drawText("SERIF 폰트", 10f, 250f, paint);
		
		t = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL);
		// paint.setTypeface(t);
	paint.setTextSkewX(-0.5f);
		canvas.drawText("SANS_SERIF 폰트", 10f, 300f, paint);
	
		
		super.onDraw(canvas);
	}
}
